package thread.basepackage.t5;

/**
 * 使用return停止线程
 * Created by cuihao on 2017/11/28.
 */
public class MyThread extends Thread {
    @Override
    public void run() {
        while (true) {
            if (this.isInterrupted()) {
                System.out.println("停止了！");
                return;
            }
            System.out.println("timer = " + System.currentTimeMillis());
            System.out.println(Thread.currentThread().getName());

        }
    }
}
